﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using DH.Web.MVC.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using DH.Web.Filter;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Http;

namespace DH.Web.MVC.Controllers
{
    [Authorize]
    public class HomeController : DH.Web.Controllers.ControllerBase
    {
        public HomeController(IServiceCollection serviceCollection) : base(serviceCollection)
        {

        }

        [UserPermissionFilter]
        public IActionResult Index()
        {
            ViewBag.CurrentUser = CurrentUser;
            return View();
        }

        [UserPermissionFilter]
        public IActionResult Index2()
        {
            ViewBag.CurrentUser = CurrentUser;
            return View();
        }

        [UserPermissionFilter]
        public IActionResult Default()
        {
            
            ViewBag.CurrentUser = CurrentUser;
            return View();
        }

        /// <summary>
        /// 返回用户菜单
        /// </summary>
        /// <returns></returns>
        public IActionResult ClientData()
        {
            // 管理员享有所有菜单权限


            return null;
        }

        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

        
    }
}
